<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>链式编程-简单函数链式调用</title>
</head>
<body>
<script type="text/javascript">
	
	function Dog () {
		this.run = function () {
			alert('run...');
			return this;
		},
		this.eat = function () {
			alert('eat...');
			return this;
		}
		this.sleep = function () {
			alert('sleep...');
			return this;
		}
	}

	var d = new Dog();

	d.run().eat().sleep();
</script>
</body>
</html>